<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar" th:fragment="aside">
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="/back/img/user2-160x160.jpg" class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
                <p><span class="hidden-xs" th:text="${#authentication.name}"></span></p>
                <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
            </div>
        </div>
        <!-- search form -->
        <!--<form action="#" method="get" class="sidebar-form">
    <div class="input-group">
        <input type="text" name="q" class="form-control" placeholder="搜索...">
        <span class="input-group-btn">
        <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
        </button>
      </span>
    </div>
</form>-->
        <!-- /.search form -->


        <!-- sidebar menu: : style can be found in sidebar.less -->
        <ul class="sidebar-menu">
            <li class="header">菜单</li>

            <li id="admin-index"><a href="/back/admin_index"><i class="fa fa-dashboard"></i> <span>首页</span></a></li>

            <!-- 菜单 -->



            <li class="treeview" id="system">
                <a href="#">
                    <i class="fa fa-folder"></i> <span>系统管理</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">

                    <li id="admin" sec:authorize="hasAnyAuthority('/admin/all')">
                        <a href="/back/admin/all">
                            <i class="fa fa-circle-o"></i> 用户管理
                        </a>
                    </li>

                    <li id="role" sec:authorize="hasAnyAuthority('/role/all')">
                        <a href="/back/role/all">
                            <i class="fa fa-circle-o"></i> 角色管理
                        </a>
                    </li>

                    <li id="permission" sec:authorize="hasAnyAuthority('/permission/all')">
                        <a href="/back/permission/all">
                            <i class="fa fa-circle-o"></i> 权限管理
                        </a>
                    </li>

                </ul>
            </li>


            <li class="treeview" id="business">
                <a href="#">
                    <i class="fa fa-laptop"></i> <span>业务管理</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">

                    <li id="category" sec:authorize="hasAnyAuthority('/category/all')">
                        <a href="/back/category/all">
                            <i class="fa fa-circle-o"></i> 类型管理
                        </a>
                    </li>

                    <li id="product" sec:authorize="hasAnyAuthority('/product/all')">
                        <a href="/back/product/all">
                            <i class="fa fa-circle-o"></i> 产品管理
                        </a>
                    </li>
                </ul>
            </li>
        </ul>
    </section>
    <!-- /.sidebar -->
    <script>
        $(function () {
            // 点击外层菜单时记录他的id
            $(".treeview").click(function () {
                sessionStorage.menu = $(this).attr("id");
            })
            // 点击内层菜单时记录他的id
            $(".treeview-menu li").click(function () {
                sessionStorage.menu2 = $(this).attr("id");
            })
            // 对已点击的外层菜单添加class属性为active
            $("#"+sessionStorage.menu).addClass("active");
            // 对已点击的内层菜单添加颜色样式
            $("#"+sessionStorage.menu2+" a").css("color","white");

        })

    </script>
</aside>